﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;

namespace Model
{
    public partial class MainWindow : Window
    {
        private DirectorySearchModel _model = new DirectorySearchModel();
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);

        }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = _model;

        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var selectedStockObject = listBox1.SelectedItems[0] as string;
            if (selectedStockObject == null)
            {
                return;
            }

            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.FileName = "explorer.exe";
            startInfo.Arguments = "/select,\"" + selectedStockObject + "\"";

            Process.Start(startInfo);

        }
    }
}